const express = require("express");
const { createProxyMiddleware } = require("http-proxy-middleware");
const app = express();

app.use(express.static("build"));
app.listen(8081);

// 在发布前端资源的服务器上，实现一个代理服务器
// 此处我们使用 http-proxy-midwaver node模块来模拟 nginx
app.use(
  "/api",
  createProxyMiddleware({
    target: "https://www.ahsj.link/rambo",
    changeOrigin: true,
    pathRewrite: {
      "^/api": "",
    },
  })
);
